﻿Public Class Form1
  Private Sub Button1_Click(ByVal sender _
        As System.Object, _
        ByVal e As System.EventArgs) _
        Handles Button1.Click

    OpenFileDialog1.InitialDirectory = "C:\"
    OpenFileDialog1.Filter = _
       "file di testo (*.txt)|*.txt|" & _
       "tutti i file (*.*)|*.*"
    OpenFileDialog1.FilterIndex = 1
    openFileDialog1.RestoreDirectory = True

    If openFileDialog1.ShowDialog() = _
       Windows.Forms.DialogResult.OK Then
      ' codice per leggere il file
      Me.TextBox1.Text = _
         My.Computer.FileSystem.ReadAllText("" & _
         OpenFileDialog1.FileName)
    End If
  End Sub

  Private Sub Button2_Click(ByVal sender _
        As System.Object, _
        ByVal e As System.EventArgs) _
        Handles Button2.Click
    Me.TextBox1.Text = ""
  End Sub
End Class
